<?php
	$headURL = '.';

	function C($name, $method){
		global $headURL;
		require_once($headURL."/libs/Controller/".$name."Controller.class.php");	
		eval('$obj = new '.$name.'Controller();$obj->'.$method.'();');
	}
	//C('admin', 'login');

	function M($name){
		global $headURL;
		require_once($headURL."/libs/Model/".$name."Model.class.php");	
		eval('$obj = new '.$name.'Model();');
		return $obj;
	}

	function V($name){
		global $headURL;	
		require_once($headURL."/libs/core/".$name."View.class.php");	
		eval('$obj = new '.$name.'View();');
		return $obj;
	}
	
	function custom($url, $name){
		global $headURL;	
		require_once($headURL."/libs/".$url."/".$name.".class.php");	
		eval('$obj = new '.$name.'();');
		return $obj;
	}

	//加密
	function daddslashes($str){
		//get_magic_quotes_gpc()  返回t/f犯法无法执行  addslashes 转义
		return (!get_magic_quotes_gpc())?addslashes($str):$str;
	}

	//调用插件
	function ORG($path, $name, $params=array()){//path路径 name三方类 params类初始化的属性格式array(属性名1=>值..)
		global $headURL;
		require_once($headURL.'/libs/ORG/'.$path.$name.'.class.php');
		//eval('$obj = new '.#name.'();');
		$obj = new $name();
		if(!empty($params)){
			foreach ($params as $key => $value) {
				$obj->$key = $value;
			}
		}
		return $obj;
	}

?>